<%--
 *  File:    StandardManagementSummary
 *  @Author: jackwang 
 *  Date:    2013/9/9
 *
 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java" %>     
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>

<%@ page contentType = "text/html;charset=UTF-8" %>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<% //--------------------------------------  setting logger --%>
<%
  	Category cat = Category.getInstance("jsp.StandardManagementSummary");  
%>

<% //--------------------------------------  variant and initialization --%>
<%
  	String strModuleName = "COM";
  	String strTableName = "v_opencontrol";
	String privilegeCode = "A01009";
	String contextPath = request.getContextPath();
%>

<% //--------------------------------------  include files list --%>
<%@ include file="/inc/Security.inc" %>
<%@ include file="/inc/PageDefault.inc" %>
<%@ include file="/inc/LocationDefault.inc" %>
<%@ include file="/rpt/ReportURL.inc"%>


<html>
<head>
<title>StandardManagementSummary.jsp</title>
<PageFlow:CheckPageFlow pageName="p_opencontrolsummary"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%= contextPath%>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%= contextPath%>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%= contextPath%>/js/ScriptLib.js"></script>
<%@ include file="/inc/SummaryDivision.inc" %>

<% //--------------------------------------  output variant from pageflow --%>
<%
  	Vector totalsummary = (Vector)pageContext.getAttribute("totalsummary");
  	if(totalsummary == null)
  	{
    	totalsummary = new Vector();
  	}
  	Vector prodsvector = (Vector)pageContext.getAttribute("prodsvector");
  	if(prodsvector==null) prodsvector=new Vector();
  	//out.print(prodsvector);
%>
<style type="text/css">
  .seasons1987 table {
     border-top-width: 0px;
     border-right-width: 0px;
     border-bottom-width: 0px;
     border-left-width: 0px;
  }
  .table_southidc{
BACKGROUND-COLOR: #A4B6D7;
word-break:break-all;
}

.table_southidc th{
font-size:14px;
padding-top:5px;
height:25px;
BACKGROUND-IMAGE:url('../image/titlebg.gif');COLOR:#000;
}

.table_southidc tr {
background-color:#ECF5FF;
}

.table_southidc tr td{
height:20px;
}

.table_southidc tr td a{
color:#1D2EFA;
}
  </style>
<script>
function clickRow(id,status)
{
  document.cform.opencontrolid.value = id;
  document.cform.status.value = status;
  parent.down.location.href ="<%= contextPath%>/Blank.jsp?<%= OvalTools.randomURL() %>";
}

function page_delete()
{
	var isbottom = document.cform.isbottom.value;
	if(isbottom=="N")
	{
		alert("<%= message.getMessageDesc("NOT_LEAF",label.getLabelName("L_Group",false)) %>");
		return;
	}	
  var productgroupid = document.cform.productgroupid.value;
  if(productgroupid == null || productgroupid.length == 0 || productgroupid == "" || productgroupid == "-1")
    return;
  
  if(!confirm("<%= message.getMessageDesc("ARE_YOU_SURE_DEL") %>")) return;
  document.cform.actionname.value = "delete";
  isRunning = true;
  document.cform.submit();
}

function page_edit()
{
  var opencontrolid = document.cform.opencontrolid.value;
  if(opencontrolid == null || opencontrolid.length == 0 || opencontrolid == "" || opencontrolid == "-1")
    return;
  parent.down.location.href = "StandardManagementEdit.jsp?<%= OvalTools.randomURL() %>&opencontrolid=" + opencontrolid;
}

function page_createsub()
{
  var parentgroupid = document.cform.productgroupid.value;
  if(parentgroupid == null || parentgroupid.length == 0 || parentgroupid == "" || parentgroupid == "-1")
    return;
  parent.down.location.href = "ProductGroupEdit.jsp?<%= OvalTools.randomURL() %>&parentgroupid=" + parentgroupid;
}

function page_mapproduct()
{
  if(document.cform.status.value==28){
  	alert("无效标准无法映射产品！");
  	return;
  }
  var opencontrolid = document.cform.opencontrolid.value;
  if(opencontrolid == null || opencontrolid.length == 0 || opencontrolid == "" || opencontrolid == "-1")
    return;
  parent.down.location.href = "zylOpenDetailWindow.jsp?<%= OvalTools.randomURL() %>&opencontrolid=" + opencontrolid;
}

function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  editform.action = "StandardManagementSummary.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();  
}

function page_new(){
	url='StandardManagementEdit.jsp?<%= OvalTools.randomURL() %>';
	parent.down.location.href=url
}

function page_export(){
 //window.open("<%= reportURL %>/servlet/ExcecuteReport/zylreportproductgroup.sox?__format=xlsx&__folder=/ovalreport");
}
</script>
</head>
<body>
	
	<% //--------------------------------------  hidden form variant --%>	
	<form name="cform" method="post" action="<%= contextPath%>/Dispatcher"  target="_parent">
	<input type="hidden" name="pagename" value="p_opencontrolsummary">
    <input type="hidden" name="actionname">   

	<% //--------------------------------------  page location --%>
	<%@ include file="/inc/PageLocation.inc" %>
		
	<table width="100%" cellspacing="0" border="0" cellpadding="0">
  	<tr> 
    	<td> 
      		<table width="100%" border="0" cellspacing="0">
        	<tr> 
          		<td class="summary_top" colspan="2" ></td>
        	</tr>
        	<tr>
          		<td>&nbsp;&nbsp;</td>
          		<td>
          			<table>
          				<%@ include file="/inc/SummarySearch.inc" %>
          			</table>
          		</td>	
        	</tr>
      		</table>
      
      
      		<table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center" class="seasons1987">
        	
        	<% //--------------------------------------  summary header --%>
        	<tr class="deepblue-left">
        		<td width="4%" class="title_center" rowspan="2">&nbsp;</td> 
           		<td width="6%" class="title_center" rowspan="2"><%= label.getLabelName("L_Dept") %></td>
          		<td width="6%" class="title_center" rowspan="2"><%= label.getLabelName("L_OpenType") %></td>
          		<td width="4%" class="title_center" rowspan="2"><%= label.getLabelName("L_ConditionNumber") %></td>
          		<td width="7%" class="title_center" rowspan="2"><%= label.getLabelName("L_AddUpYear")%></td>
          		<td width="7%" class="title_center" rowspan="2"><%= label.getLabelName("L_AddUpMonth")%></td>
          		<td width="7%" class="title_center" rowspan="2"><%= label.getLabelName("L_ProductGroupName")%></td>
          		<td width="30%" class="title_center"><%= label.getLabelName("L_ConditionEntry")%></td>
          		<!-- 
          		<td width="6%" class="title_center" ><%= label.getLabelName("L_AddUpMonths")%></td>
          		<td width="6%" class="title_center" ><%= label.getLabelName("L_UOM1")%></td>
          		<td width="6%" class="title_center" ><%= label.getLabelName("L_AddUpQty")%></td>
          		 -->
          		<td width="6%" class="title_center" rowspan="2"><%= label.getLabelName("L_Status")%></td>
        	</tr>
            <tr class="deepblue-left">
              <td>
               <table border="1" frame="void" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" >
               <tr>
				<td class="title_center" width="3%"><%= label.getLabelName("L_SortNo") %></td>
				<td class="title_center" width="11%"><%= label.getLabelName("L_Product")%></td>
				<td class="title_center" width="4%"><%= label.getLabelName("L_AddUpMonths")%></td>
				<td class="title_center" width="6%"><%= label.getLabelName("L_UOM1")%></td>
				<td class="title_center" width="6%"><%= label.getLabelName("L_AddUpQty")%></td>
			   </tr>
			   </table>
			  </td>
		    </tr>
        	<%
             	int i = 0;
             	String strClassType = new String();   
             	boolean bHasChecked = false;    
             	Integer nDefaultProductGroupId = new Integer(-1); 
             	Integer nDefaultStatus = new Integer(-1); 
             	String nDefaultIsBottom = "";
             	Vector oneprods=null;
          	%>
          	<logic:iterate id="summary" collection="<%= totalsummary %>">     
        
        	<%
            	HashMap onerow = (HashMap)summary; 
            	String strIsChecked = new String("");
            	if(i%2 == 1)
            	{
              		strClassType = "td-listrom";
            	}else{                    
              		strClassType = "";
            	}
	            
            	if(!bHasChecked)
            	{
              		strIsChecked = "Checked";                       
              		bHasChecked = true;      
              		nDefaultProductGroupId = (Integer)(onerow.get("opencontrolid"));       
              		nDefaultStatus = (Integer)(onerow.get("status"));       
            	}
            	i++;                         
          	%>
          	<tr  onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull( strClassType )%>'"  onClick="javascript:radiotrue('radio<%=i%>');clickRow('<custom:write property="opencontrolid" name="summary"/>','<custom:write property="status" name="summary"/>');"  class="<%= strClassType%>">     
          		<td ><input id="radio<%=i%>" type="radio" name="radiobutton" class="checkbox" <%= strIsChecked%>></td>
            	<td><custom:write property="deptname" name="summary" nbsp="true"/></td>
            	<td><custom:write property="opentype" name="summary" nbsp="true" dictType="DicrelationType"/></td>
            	<td><custom:write property="sortno" name="summary" nbsp="true"/></td>
            	<td><custom:write property="addupyear" name="summary" nbsp="true"/></td>
            	<td><custom:write property="addupmonth" name="summary" nbsp="true"/></td>
            	<td><custom:write property="productgroupname" name="summary" nbsp="true"/></td>
            	<!-- 
            	<td><custom:write property="addupmonths" name="summary" nbsp="true"/></td>
            	<td><custom:write property="unit" name="summary" nbsp="true" dictType="UomType"/></td>
            	<td><custom:write property="qty" name="summary" nbsp="true"/></td>
            	 -->
            	 <td>
            	   <%
            	     oneprods=new Vector();
            	     for(int ii=0;ii<prodsvector.size();ii++){
            	    	if(((Integer)onerow.get("opencontrolid")).equals(((Integer)((HashMap)prodsvector.get(ii)).get("opencontrolid")))){
            	    		oneprods.add((HashMap)prodsvector.get(ii));
            	    	}
            	     }
            	     //out.print(oneprods);
            	   %>
            	   <table border="1" frame="void" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" >
            	     <logic:iterate id="onehash" collection="<%= oneprods %>" indexId="prodseq">
            	      <tr class="<%= strClassType%>" >
            	        <td class="title_center" width="3%"><%=prodseq.intValue()+1 %></td>
            	        <td width="11%">
            	           <%
            	        	HashMap onehash1 = (HashMap)pageContext.getAttribute("onehash");  
            	        	if((String)onehash1.get("prodcodes")!=null){
            	           %>
            	        	 <custom:write property="prodcodes" name="onehash" nbsp="true"/>
            	        	<%}else{%>
            	        	 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
            	        	<%}%>
            	        </td>
            	        <td class="title_center" width="4%"><custom:write property="addupmonths" name="onehash" nbsp="true"/></td>
            	        <td class="title_center" width="6%"><custom:write property="unit" name="onehash" nbsp="true" dictType="UomType"/></td>
            	        <td class="title_center" width="6%"><custom:write property="qty" name="onehash" nbsp="true"/></td>
            	      </tr>
            	     </logic:iterate> 
            	   </table>
            	 </td>
            	<td><custom:write property="status" name="summary" nbsp="true" dictType="Status"/></td>
          	</tr>
          	</logic:iterate> 
        	
        	<% //--------------------------------------  default value --%>       
        	<input type="hidden" name="opencontrolid" value="<%= nDefaultProductGroupId%>">
        	<input type="hidden" name="status" value="<%= nDefaultStatus%>">
        	
        	<% //--------------------------------------  flipping page --%>
    		<%@ include file="/inc/SummaryAction.inc" %>
    		</table>
    		
    		<% //--------------------------------------  page operation button --%>
      		<table width="100%" cellspacing="0" cellpadding="0">
        	<tr> 
          		<td class="summary_top"></td>
        	</tr>
        	<tr> 
          		<td class="td_center">
            		<a onclick="page_new();"><custom:button type="1" label="L_New" imgsrc="new.gif" border="0" style="width:60" privilegeCode="MB-A0100901"/></a>
            		<a onclick="page_edit()"><custom:button type="1" label="L_Edit" imgsrc="edit.gif" border="0" style="width:60" privilegeCode="MB-A0100902"/></a>
            		<%--<a onclick="page_delete()"><custom:button type="1" label="L_Delete" imgsrc="delete.gif" border="0" style="width:60"/></a>--%>
            		<%--<a onclick="page_createsub()"><custom:button type="1" label="L_CreatSubGroup" imgsrc="CreatSubGroup.gif" border="0"/></a>--%>
            		<!-- <a onclick="page_mapproduct()"><custom:button type="1" label="L_Map" imgsrc="Map.gif" border="0" style="width:60" /></a>
            		<a onclick="page_export();"><custom:button type="1" label="L_ALL_Execcd" imgsrc="Map.gif" border="0" style="width:60" privilegeCode="MB-CPFZ04"/></a> -->
          		</td>
        	</tr>
      		</table>
    	</td>
  	</tr>
  	</table>
</form>
</body>
</html>


